//
// Created by zzx on 2022/10/8.
//

#include "HelpMenu.h"
#include <QMessageBox>
#include <QString>

HelpMenu::HelpMenu() : ruleMsg(this), aboutMsg(this){
    setTitle("帮助");
    auto gameRule = addAction("游戏规则");
    auto about = addAction("关于");
    this->ruleMsg.setWindowTitle("24点游戏规则");
    double size = 400;
    this->ruleMsg.resize(size, size * 0.618);
    this->ruleMsg.setText("使用给出的四个数字，利用加减乘除算出24。\n数字可以交换顺序，可以任意添加括号。");
    connect(gameRule, &QAction::triggered, this, [=](){
        this->ruleMsg.show();
    });
    aboutMsg.setWindowTitle("关于本程序");
    aboutMsg.resize(size, size * 0.618);
    QString text = "本程序是由zzx开发的24点游戏。<br>"
                   "代号是\"鲁班志24\"。<br>"
                   "项目地址为: <a href='https://gitee.com/zzx2070276239/24-point-game.git'>Gitee</a><br>"
                   "欢迎报告BUG和交流。";
    aboutMsg.setText(text);
    connect(about, &QAction::triggered, this, [=](){
        aboutMsg.show();
    });
}
